home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / GNU / emacs.inst / emacs19.idb / usr / gnu / info / emacs-8.z / emacs-8
Encoding:
GNU Info File  |  1994-08-02  |  47.2 KB  |  1,169 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.54 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Change Window,  Prev: Pop Up Window,  Up: Windows
  6.  
  7. Deleting and Rearranging Windows
  8. ================================
  9.  
  10. `C-x 0'
  11.      Get rid of the selected window (`delete-window').  That is a zero.
  12.  
  13. `C-x 1'
  14.      Get rid of all windows except the selected one
  15.      (`delete-other-windows').
  16.  
  17. `C-x ^'
  18.      Make selected window taller (`enlarge-window').
  19.  
  20. `C-x }'
  21.      Make selected window wider (`enlarge-window-horizontally').
  22.  
  23.    To delete a window, type `C-x 0' (`delete-window').  (That is a
  24. zero.)  The space occupied by the deleted window is given to an
  25. adjacent window (but not the minibuffer window, even if that is active
  26. at the time).  Once a window is deleted, its attributes are forgotten;
  27. only restoring a window configuration can bring it back.  Deleting the
  28. window has no effect on the buffer it used to display; the buffer
  29. continues to exist, and you can select it in any window with `C-x b'.
  30.  
  31.    `C-x 1' (`delete-other-windows') is more powerful than `C-x 0'; it
  32. deletes all the windows except the selected one (and the minibuffer);
  33. the selected window expands to use the whole frame except for the echo
  34. area.
  35.  
  36.    To readjust the division of space among vertically adjacent windows,
  37. use `C-x ^' (`enlarge-window').  It makes the currently selected window
  38. get one line bigger, or as many lines as is specified with a numeric
  39. argument.  With a negative argument, it makes the selected window
  40. smaller.  `C-x }' (`enlarge-window-horizontally') makes the selected
  41. window wider by the specified number of columns.  The extra screen
  42. space given to a window comes from one of its neighbors, if that is
  43. possible.  If this makes any window too small, it is deleted and its
  44. space is given to an adjacent window.  The minimum size is specified by
  45. the variables `window-min-height' and `window-min-width'.
  46.  
  47. 
  48. File: emacs,  Node: Frames,  Next: Major Modes,  Prev: Windows,  Up: Top
  49.  
  50. Frames and X Windows
  51. ********************
  52.  
  53.    When using the X Window System, you can create multiple windows at
  54. the X level in a single Emacs session.  Each X window that belongs to
  55. Emacs displays a "frame" which can contain one or several Emacs windows.
  56. A frame initially contains a single general-purpose Emacs window which
  57. you can subdivide vertically or horizontally into smaller windows.  A
  58. frame normally contains its own echo area and minibuffer, but you can
  59. make frames that don't have these--they use the echo area and
  60. minibuffer of another frame.
  61.  
  62.    Anything you do in one frame also affects the other frames.  For
  63. instance, if you put text in the kill ring in one frame, you can yank it
  64. in another frame.  If you exit emacs through `C-x C-c' in one frame, it
  65. terminates all the frames.  To delete just one frame, use `C-x 5 0'.
  66.  
  67.    To avoid confusion, we reserve the word "window" for the
  68. subdivisions that Emacs implements, and never use it to refer to a
  69. frame.
  70.  
  71. * Menu:
  72.  
  73. * Mouse Commands::     Moving, cutting, and pasting, with the mouse.
  74. * Secondary Selection::Cutting without altering point and mark.
  75. * Creating Frames::    Creating additional Emacs frames with various contents.
  76. * Frame Parameters::   Changing the colors and other modes of frames.
  77. * Scroll Bars::        How to enable and disable scroll bars; how to use them.
  78. * Menu Bars::          Enabling and disabling the menu bar.
  79. * Faces::              How to change the display style using faces.
  80. * Modifying Faces::    How to change what a particular face looks like.
  81. * Misc X::             Iconifying and deleting frames.  Region highlighting.
  82.  
  83. 
  84. File: emacs,  Node: Mouse Commands,  Next: Secondary Selection,  Up: Frames
  85.  
  86. Mouse Commands
  87. ==============
  88.  
  89. `mouse-1'
  90.      Move point to where you click (`mouse-set-point').  This is
  91.      normally the left button.
  92.  
  93. `drag-mouse-1'
  94.      Set the region to the text you select by dragging, and copy it to
  95.      the kill ring (`mouse-set-region'). Thus, you can specify both
  96.      ends of the region.
  97.  
  98.      If you move the mouse off the top or bottom of the window while
  99.      dragging, the window scrolls at a steady rate until you move the
  100.      mouse back into the window.  This way, you can mark regions that
  101.      don't fit entirely on the screen.
  102.  
  103. `mouse-2'
  104.      Yank the last killed text, where you click (`mouse-yank-at-click').
  105.      This is normally the middle button.
  106.  
  107. `mouse-3'
  108.      This command, `mouse-save-then-kill', has several functions
  109.      depending on where you click and the status of the region.
  110.  
  111.      If you have a highlighted region, or if the region was set just
  112.      before by dragging button 1, `mouse-save-then-kill' adjusts the
  113.      nearer end of the region by moving it to where you click.  The
  114.      adjusted region's text also replaces the old region's text in the
  115.      kill ring.
  116.  
  117.      Otherwise, `mouse-save-then-kill' sets mark where you click,
  118.      without changing point.  It copies the new region to the kill ring.
  119.  
  120.      If you originally specified the region using a double or triple
  121.      Mouse-1, so that the region is defined to consist of entire words
  122.      or lines, then adjusting the region also proceeds by entire words
  123.      or lines.
  124.  
  125.      If you use `mouse-save-then-kill' twice in a row at the same place,
  126.      that kills the region already selected.
  127.  
  128. `double-mouse-1'
  129.      This key sets the region around the word which you click on.
  130.  
  131. `double-drag-mouse-1'
  132.      This key selects a region made up of the words that you drag
  133.      across.
  134.  
  135. `triple-mouse-1'
  136.      This key sets the region around the line which you click on.
  137.  
  138. `triple-drag-mouse-1'
  139.      This key selects a region made up of the lines that you drag
  140.      across.
  141.  
  142.    The simplest way to kill some text is to press Mouse-1 at one end,
  143. then press Mouse-3 twice at the other end.  *Note Killing::.  To copy
  144. the text into the kill ring without deleting it from the buffer, press
  145. Mouse-3 just once--or just drag across the text with Mouse-1.  Then you
  146. can copy it elsewhere by yanking it.
  147.  
  148.    To yank the killed or copied text somewhere else, move the mouse
  149. there and press Mouse-2.  *Note Yanking::.
  150.  
  151.    The mouse commands for selecting a region are mostly compatible with
  152. the `xterm' program.
  153.  
  154.    To copy text to another X window, kill it or save it in the kill
  155. ring.  Under X, this also sets the "primary selection".  Then use the
  156. "paste" or "yank" command of the program operating the other window to
  157. insert the text from the selection.
  158.  
  159.    To copy text from another X window, use the "cut" or "copy" command
  160. of the program operating the other window, to select the text you want.
  161. Then yank it in Emacs with `C-y' or Mouse-2.
  162.  
  163.    When Emacs puts text into the kill ring, or rotates text to the front
  164. of the kill ring, it sets the "primary selection" in the X server.
  165. This is how other X clients can access the text.  Emacs also stores the
  166. text in the cut buffer, if the text is short enough (`x-cut-buffer-max'
  167. specifies the maximum number of characters); putting long strings in
  168. the cut buffer can be slow.
  169.  
  170.    When you yank in Emacs, Emacs checks for a primary selection in
  171. another program; after that, it checks for text in the cut buffer.
  172.  
  173. 
  174. File: emacs,  Node: Secondary Selection,  Next: Creating Frames,  Prev: Mouse Commands,  Up: Frames
  175.  
  176. Secondary Selection
  177. ===================
  178.  
  179.    The "secondary selection" is another way of selecting text using X.
  180. It does not use point or the mark, so you can use it to kill text
  181. without setting point or the mark.
  182.  
  183. `drag-M-mouse-1'
  184.      Set the secondary selection, with one end at the place where you
  185.      press down the button, and the other end at the place where you
  186.      release it (`mouse-set-secondary').  In Transient Mark mode,
  187.      highlighting appears and changes as you drag.
  188.  
  189.      If you move the mouse off the top or bottom of the window while
  190.      dragging, the window scrolls at a steady rate until you move the
  191.      mouse back into the window.  This way, you can mark regions that
  192.      don't fit entirely on the screen.
  193.  
  194. `M-mouse-1'
  195.      Set one endpoint for the "secondary selection"
  196.      (`mouse-start-secondary').
  197.  
  198. `M-mouse-3'
  199.      Make a secondary selection, using the place specified with
  200.      `M-mouse-1' as the other end (`mouse-secondary-save-then-kill').
  201.      A second click at the same place kills the secondary selection
  202.      just made.
  203.  
  204. `M-mouse-2'
  205.      Kill the secondary selection (`mouse-kill-secondary').
  206.  
  207.    Double or triple clicking of `M-Mouse-1' operates on words and
  208. lines, much like Mouse-1.
  209.  
  210. 
  211. File: emacs,  Node: Creating Frames,  Next: Frame Parameters,  Prev: Secondary Selection,  Up: Frames
  212.  
  213. Creating Frames
  214. ===============
  215.  
  216.    The prefix key `C-x 5' is analogous to `C-x 4', with parallel
  217. subcommands.  The difference is that `C-x 5' commands create a new
  218. frame rather than just a new window in the selected frame.  (*Note Pop
  219. Up Window::.)  Different `C-x 5' commands have different ways of
  220. finding the buffer to select.
  221.  
  222. `C-x 5 b BUFNAME RET'
  223.      Select buffer BUFNAME in another window.  This runs
  224.      `switch-to-buffer-other-frame'.
  225.  
  226. `C-x 5 f FILENAME RET'
  227.      Visit file FILENAME and select its buffer in another frame.  This
  228.      runs `find-file-other-frame'.  *Note Visiting::.
  229.  
  230. `C-x 5 d DIRECTORY RET'
  231.      Select a Dired buffer for directory DIRECTORY in another frame.
  232.      This runs `dired-other-frame'.  *Note Dired::.
  233.  
  234. `C-x 5 m'
  235.      Start composing a mail message in another frame.  This runs
  236.      `mail-other-frame', and its same-frame version is `C-x m'.  *Note
  237.      Sending Mail::.
  238.  
  239. `C-x 5 .'
  240.      Find a tag in the current tag table in another frame.  This runs
  241.      `find-tag-other-frame', the multiple-frame variant of `M-.'.
  242.      *Note Tags::.
  243.  
  244. `C-x 5 r FILENAME RET'
  245.      Visit file FILENAME read-only, and select its buffer in another
  246.      frame.  This runs `find-file-read-only-other-frame'.  *Note
  247.      Visiting::.
  248.  
  249. 
  250. File: emacs,  Node: Frame Parameters,  Next: Scroll Bars,  Prev: Creating Frames,  Up: Frames
  251.  
  252. Setting Frame Parameters
  253. ========================
  254.  
  255.    This section describes commands for altering the display style and
  256. window management behavior of the selected frame.
  257.  
  258. `M-x set-foreground-color RET COLOR RET'
  259.      Specify color COLOR for the foreground of the selected frame.
  260.  
  261. `M-x set-background-color RET COLOR RET'
  262.      Specify color COLOR for the background of the selected frame.
  263.  
  264. `M-x set-cursor-color RET COLOR RET'
  265.      Specify color COLOR for the cursor of the selected frame.
  266.  
  267. `M-x set-mouse-color RET COLOR RET'
  268.      Specify color COLOR for the mouse cursor when it is over the
  269.      selected frame.
  270.  
  271. `M-x set-border-color RET COLOR RET'
  272.      Specify color COLOR for the border of the selected frame.
  273.  
  274. `M-x auto-raise-mode'
  275.      Toggle whether or not the selected frame should auto-raise.
  276.      Auto-raise means that every time you move the mouse onto the frame,
  277.      it raises the frame.
  278.  
  279. `M-x auto-lower-mode'
  280.      Toggle whether or not the selected frame should auto-lower.
  281.      Auto-lower means that every time you move the mouse off of the
  282.      frame, the frame moves to the bottom of the stack of X windows.
  283.  
  284. `M-x set-default-font RET FONT RET'
  285.      Specify font FONT as the default for the selected frame.  *Note
  286.      Font X::, for ways to list the available fonts on your system.
  287.  
  288.      You can also set a frame's default font through a pop-up menu.
  289.      Press `C-Mouse-3' to activate this menu.
  290.  
  291. 
  292. File: emacs,  Node: Scroll Bars,  Next: Menu Bars,  Prev: Frame Parameters,  Up: Frames
  293.  
  294. Scroll Bars
  295. ===========
  296.  
  297.    When using X, Emacs normally makes a "scroll bar" at the right of
  298. each Emacs window.  The scroll bar runs the height of the window, and
  299. shows a moving rectangular inner box which represents the portion of the
  300. buffer currently displayed.  The entire height of the scroll bar
  301. represents the entire length of the buffer.
  302.  
  303.    You can use Mouse-2 (normally, the middle button) in the scroll bar
  304. to move or drag the inner box up and down.  If you move it to the top
  305. of the scroll bar, you see the top of the buffer.  If you move it to
  306. the bottom of the scroll bar, you see the bottom of the buffer.
  307.  
  308.    The left and right buttons in the scroll bar scroll by controlled
  309. increments.  Mouse-1 (normally, the left button) moves the line at the
  310. level where you click up to the top of the window.  Mouse-3 (normally,
  311. the right button) moves the line at the top of the window down to the
  312. level where you click.  By clicking repeatedly in the same place, you
  313. can scroll by the same distance over and over.
  314.  
  315.    You can enable or disable Scroll Bar mode with the command `M-x
  316. scroll-bar-mode'.  With no argument, it toggles the use of scroll bars.
  317. With an argument, it turns use of scroll bars on if and only if the
  318. argument is positive.  This command applies to all frames, including
  319. frames yet to be created.
  320.  
  321.    To enable or disable scroll bars for just the selected frame, use the
  322. `M-x toggle-scroll-bar' command.
  323.  
  324. 
  325. File: emacs,  Node: Menu Bars,  Next: Faces,  Prev: Scroll Bars,  Up: Frames
  326.  
  327. Menu Bars
  328. =========
  329.  
  330.    By default, each Emacs frame has a menu bar at the top which you can
  331. use to perform certain common operations.  There's no need to describe
  332. them in detail here, as you can more easily see for yourself; also, we
  333. may change them and add to them in subsequent Emacs versions.
  334.  
  335.    Each of the operations in the menu bar is bound to an ordinary Emacs
  336. command which you can invoke equally well with `M-x' or with its own
  337. key bindings.  To see the command's name and documentation, type `C-h
  338. k' and then select the menu bar item you are interested in.
  339.  
  340.    You can turn display of menu bars on or off with `M-x menu-bar-mode'.
  341. With no argument, this command toggles Menu Bar mode, a minor mode.
  342. With an argument, the command turns Menu Bar mode on if the argument is
  343. positive, off if the argument is not positive.
  344.  
  345. 
  346. File: emacs,  Node: Faces,  Next: Modifying Faces,  Prev: Menu Bars,  Up: Frames
  347.  
  348. Using Multiple Typefaces
  349. ========================
  350.  
  351.    When using Emacs with X, you can set up multiple styles of displaying
  352. characters.  The aspects of style that you can control are the type
  353. font, the foreground color, the background color, and whether to
  354. underline.
  355.  
  356.    The way you control display style is by defining named "faces".
  357. Each face can specify a type font, a foreground color, a background
  358. color, and an underline flag; but it does not have to specify all of
  359. them.
  360.  
  361.    The style of display used for a given character in the text is
  362. determined by combining several faces.  Which faces to use is always set
  363. up by Lisp programs, at present, by means of text properties and
  364. overlays.  Any aspect of the display style that isn't specified by
  365. overlays or text properties comes from the frame itself.
  366.  
  367.    To see what faces are currently defined, and what they look like,
  368. type `M-x list-faces-display'.  It's possible for a given face to look
  369. different in different frames; this command shows the appearance in the
  370. frame in which you type it.
  371.  
  372.    When Transient Mark mode is enabled, the text of the region is
  373. highlighted when the mark is active.  This uses a face named `region';
  374. you can control the style of highlighting by changing the style of this
  375. face with the commands below.  *Note Setting Mark::, for more
  376. information about Transient Mark mode and activation and deactivation
  377. of the mark.
  378.  
  379.    One easy way to use faces is to turn on Font-Lock mode.  This minor
  380. mode, which is always local to a particular buffer, arranges to choose
  381. faces according to the syntax of the text you are editing.  It can
  382. recognize comments and strings in any major mode; for several major
  383. modes, it can also recognize and properly highlight various other
  384. important parts of the text.  To get the full benefit of Font-Lock mode,
  385. you need to choose a default font which has bold, italic, and
  386. bold-italic variants.
  387.  
  388. 
  389. File: emacs,  Node: Modifying Faces,  Next: Misc X,  Prev: Faces,  Up: Frames
  390.  
  391. Modifying Faces
  392. ===============
  393.  
  394.    Here are the commands for users to change the font of a face.
  395.  
  396. `M-x set-face-font RET FACE RET FONT RET'
  397.      Use font FONT in face FACE.
  398.  
  399. `M-x make-face-bold RET FACE RET'
  400.      Convert face FACE to use a bold version of its current font.
  401.  
  402. `M-x make-face-italic RET FACE RET'
  403.      Convert face FACE to use a italic version of its current font.
  404.  
  405. `M-x make-face-bold-italic RET FACE RET'
  406.      Convert face FACE to use a bold-italic version of its current font.
  407.  
  408. `M-x make-face-unbold RET FACE RET'
  409.      Convert face FACE to use a non-bold version of its current font.
  410.  
  411. `M-x make-face-unitalic RET FACE RET'
  412.      Convert face FACE to use a non-italic version of its current font.
  413.  
  414.    Here are the commands for users to set the colors and underline flag
  415. of a face:
  416.  
  417. `M-x set-face-foreground RET FACE RET COLOR RET'
  418.      Use color COLOR for the foreground of characters in face FACE.
  419.  
  420. `M-x set-face-background RET FACE RET COLOR RET'
  421.      Use color COLOR for the background of characters in face FACE.
  422.  
  423. `M-x set-face-underline-p RET FACE RET FLAG RET'
  424.      Specify whether to underline characters in face FACE.
  425.  
  426. `M-x invert-face RET FACE RET'
  427.      Swap the foreground and background colors of face FACE.
  428.  
  429. 
  430. File: emacs,  Node: Misc X,  Prev: Modifying Faces,  Up: Frames
  431.  
  432. Miscellaneous X Window Features
  433. ===============================
  434.  
  435.    The following commands do user-level mangement of frames under a
  436. window system:
  437.  
  438. `C-z'
  439.      To iconify the selected Emacs frame, type `C-z'
  440.      (`iconify-or-deiconify-frame').  The normal meaning of `C-z', to
  441.      suspend Emacs, is not useful under a window system, so it has a
  442.      different binding in that case.
  443.  
  444.      If you type this command on an Emacs icon, it deiconifies the
  445.      frame.
  446.  
  447. `C-x 5 0'
  448.      To delete the selected frame, type `C-x 5 0' (`delete-frame').  If
  449.      there is more than one frame in this invocation of Emacs, the
  450.      current frame is deleted.
  451.  
  452. `M-x transient-mark-mode'
  453.      Under X Windows, when Transient Mark mode is enabled, Emacs
  454.      highlights the region when the mark is active.  This is the main
  455.      motive for using Transient Mark mode.  To toggle the state of this
  456.      mode, use the command `M-x transient-mark-mode'.  *Note Mark::.
  457.  
  458. 
  459. File: emacs,  Node: Major Modes,  Next: Indentation,  Prev: Frames,  Up: Top
  460.  
  461. Major Modes
  462. ***********
  463.  
  464.    Emacs provides many alternative "major modes", each of which
  465. customizes Emacs for editing text of a particular sort.  The major modes
  466. are mutually exclusive, and each buffer has one major mode at any time.
  467. The mode line normally shows the name of the current major mode, in
  468. parentheses (*note Mode Line::.).
  469.  
  470.    The least specialized major mode is called "Fundamental mode".  This
  471. mode has no mode-specific redefinitions or variable settings, so that
  472. each Emacs command behaves in its most general manner, and each option
  473. is in its default state.  For editing any specific type of text, such
  474. as Lisp code or English text, you should switch to the appropriate
  475. major mode, such as Lisp mode or Text mode.
  476.  
  477.    Selecting a major mode changes the meanings of a few keys to become
  478. more specifically adapted to the language being edited.  The ones which
  479. are changed frequently are TAB, DEL, and LFD.  In addition, the
  480. commands which handle comments use the mode to determine how comments
  481. are to be delimited.  Many major modes redefine the syntactical
  482. properties of characters appearing in the buffer.  *Note Syntax::.
  483.  
  484.    The major modes fall into three major groups.  Lisp mode (which has
  485. several variants), C mode, Fortran mode and others are for specific
  486. programming languages.  Text mode, Nroff mode, TeX mode and Outline
  487. mode are for editing English text.  The remaining major modes are not
  488. intended for use on users' files; they are used in buffers created for
  489. specific purposes by Emacs, such as Dired mode for buffers made by Dired
  490. (*note Dired::.), and Mail mode for buffers made by `C-x m' (*note
  491. Sending Mail::.), and Shell mode for buffers used for communicating
  492. with an inferior shell process (*note Interactive Shell::.).
  493.  
  494.    Most programming language major modes specify that only blank lines
  495. separate paragraphs.  This is so that the paragraph commands remain
  496. useful.  (*Note Paragraphs::.)  They also cause Auto Fill mode to use
  497. the definition of TAB to indent the new lines it creates.  This is
  498. because most lines in a program are usually indented.  (*Note
  499. Indentation::.)
  500.  
  501. * Menu:
  502.  
  503. * Choosing Modes::     How major modes are specified or chosen.
  504.  
  505. 
  506. File: emacs,  Node: Choosing Modes,  Prev: Major Modes,  Up: Major Modes
  507.  
  508. How Major Modes are Chosen
  509. ==========================
  510.  
  511.    You can select a major mode explicitly for the current buffer, but
  512. most of the time Emacs determines which mode to use based on the file
  513. name or on special text in the file.
  514.  
  515.    Explicit selection of a new major mode is done with a `M-x' command.
  516. From the name of a major mode, add `-mode' to get the name of a command
  517. to select that mode.  Thus, you can enter Lisp mode by executing `M-x
  518. lisp-mode'.
  519.  
  520.    When you visit a file, Emacs usually chooses the right major mode
  521. based on the file's name.  For example, files whose names end in `.c'
  522. are edited in C mode.  The correspondence between file names and major
  523. mode is controlled by the variable `auto-mode-alist'.  Its value is a
  524. list in which each element has the form
  525.  
  526.      (REGEXP . MODE-FUNCTION)
  527.  
  528. For example, one element normally found in the list has the form
  529. `("\\.c$" . c-mode)', and it is responsible for selecting C mode for
  530. files whose names end in `.c'.  (Note that `\\' is needed in Lisp
  531. syntax to include a `\' in the string, which is needed to suppress the
  532. special meaning of `.' in regexps.)  The only practical way to change
  533. this variable is with Lisp code.
  534.  
  535.    You can specify which major mode should be used for editing a certain
  536. file by a special sort of text in the first nonblank line of the file.
  537. The mode name should appear in this line both preceded and followed by
  538. `-*-'.  Other text may appear on the line as well.  For example,
  539.  
  540.      ;-*-Lisp-*-
  541.  
  542. tells Emacs to use Lisp mode.  Such an explicit specification overrides
  543. any defaulting based on the file name.  Note how the semicolon is used
  544. to make Lisp treat this line as a comment.
  545.  
  546.    Another format of mode specification is
  547.  
  548.      -*-Mode: MODENAME;-*-
  549.  
  550. which allows you to specify local variables as well, like this:
  551.  
  552.      -*- mode: MODENAME; VAR: VALUE; ... -*-
  553.  
  554. *Note File Variables::, for more information about this.
  555.  
  556.    When you visit a file that does not specify a major mode to use, or
  557. when you create a new buffer with `C-x b', the variable
  558. `default-major-mode' specifies which major mode to use.  Normally its
  559. value is the symbol `fundamental-mode', which specifies Fundamental
  560. mode.  If `default-major-mode' is `nil', the major mode is taken from
  561. the previously selected buffer.
  562.  
  563.    If you change the major mode of a buffer, you can go back to the
  564. major mode Emacs would choose automatically: use the command `M-x
  565. normal-mode' to do this.  This is the same function that `find-file'
  566. calls to choose the major mode.  It also processes the file's local
  567. variables list if any.
  568.  
  569. 
  570. File: emacs,  Node: Indentation,  Next: Text,  Prev: Major Modes,  Up: Top
  571.  
  572. Indentation
  573. ***********
  574.  
  575.    This chapter describes the Emacs commands that add, remove, or
  576. adjust indentation.
  577.  
  578. `TAB'
  579.      Indent current line "appropriately" in a mode-dependent fashion.
  580.  
  581. `LFD'
  582.      Perform RET followed by TAB (`newline-and-indent').
  583.  
  584. `M-^'
  585.      Merge two lines (`delete-indentation').  This would cancel out the
  586.      effect of LFD.
  587.  
  588. `C-M-o'
  589.      Split line at point; text on the line after point becomes a new
  590.      line indented to the same column that it now starts in
  591.      (`split-line').
  592.  
  593. `M-m'
  594.      Move (forward or back) to the first nonblank character on the
  595.      current line (`back-to-indentation').
  596.  
  597. `C-M-\'
  598.      Indent several lines to same column (`indent-region').
  599.  
  600. `C-x TAB'
  601.      Shift block of lines rigidly right or left (`indent-rigidly').
  602.  
  603. `M-i'
  604.      Indent from point to the next prespecified tab stop column
  605.      (`tab-to-tab-stop').
  606.  
  607. `M-x indent-relative'
  608.      Indent from point to under an indentation point in the previous
  609.      line.
  610.  
  611.    Most programming languages have some indentation convention.  For
  612. Lisp code, lines are indented according to their nesting in
  613. parentheses.  The same general idea is used for C code, though many
  614. details are different.
  615.  
  616.    Whatever the language, to indent a line, use the TAB command.  Each
  617. major mode defines this command to perform the sort of indentation
  618. appropriate for the particular language.  In Lisp mode, TAB aligns the
  619. line according to its depth in parentheses.  No matter where in the
  620. line you are when you type TAB, it aligns the line as a whole.  In C
  621. mode, TAB implements a subtle and sophisticated indentation style that
  622. knows about many aspects of C syntax.
  623.  
  624.    In Text mode, TAB runs the command `tab-to-tab-stop', which indents
  625. to the next tab stop column.  You can set the tab stops with `M-x
  626. edit-tab-stops'.
  627.  
  628. * Menu:
  629.  
  630. * Indentation Commands::  Various commands and techniques for indentation.
  631. * Tab Stops::             You can set arbitrary "tab stops" and then
  632.                             indent to the next tab stop when you want to.
  633. * Just Spaces::           You can request indentation using just spaces.
  634.  
  635. 
  636. File: emacs,  Node: Indentation Commands,  Next: Tab Stops,  Prev: Indentation,  Up: Indentation
  637.  
  638. Indentation Commands and Techniques
  639. ===================================
  640.  
  641.    If you just want to insert a tab character in the buffer, you can
  642. type `C-q TAB'.
  643.  
  644.    To move over the indentation on a line, do `M-m'
  645. (`back-to-indentation').  This command, given anywhere on a line,
  646. positions point at the first nonblank character on the line.
  647.  
  648.    To insert an indented line before the current line, do `C-a C-o
  649. TAB'.  To make an indented line after the current line, use `C-e LFD'.
  650.  
  651.    `C-M-o' (`split-line') moves the text from point to the end of the
  652. line vertically down, so that the current line becomes two lines.
  653. `C-M-o' first moves point forward over any spaces and tabs.  Then it
  654. inserts after point a newline and enough indentation to reach the same
  655. column point is on.  Point remains before the inserted newline; in this
  656. regard, `C-M-o' resembles `C-o'.
  657.  
  658.    To join two lines cleanly, use the `M-^' (`delete-indentation')
  659. command.  It deletes the indentation at the front of the current line,
  660. and the line boundary as well, replacing them with a single space.  As
  661. a special case (useful for Lisp code) the single space is omitted if
  662. the characters to be joined are consecutive open parentheses or closing
  663. parentheses, or if the junction follows another newline.  To delete
  664. just the indentation of a line, go to the beginning of the line and use
  665. `M-\' (`delete-horizontal-space'), which deletes all spaces and tabs
  666. around the cursor.
  667.  
  668.    If you have a fill prefix, `M-^' deletes the fill prefix if it
  669. appears after the newline that is deleted.  *Note Fill Prefix::.
  670.  
  671.    There are also commands for changing the indentation of several
  672. lines at once.  `C-M-\' (`indent-region') gives each line which begins
  673. in the region the "usual" indentation by invoking TAB at the beginning
  674. of the line.  A numeric argument specifies the column to indent to, and
  675. each line is shifted left or right so that its first nonblank character
  676. appears in that column.  `C-x TAB' (`indent-rigidly') moves all of the
  677. lines in the region right by its argument (left, for negative
  678. arguments).  The whole group of lines moves rigidly sideways, which is
  679. how the command gets its name.
  680.  
  681.    `M-x indent-relative' indents at point based on the previous line
  682. (actually, the last nonempty line).  It inserts whitespace at point,
  683. moving point, until it is underneath an indentation point in the
  684. previous line.  An indentation point is the end of a sequence of
  685. whitespace or the end of the line.  If point is farther right than any
  686. indentation point in the previous line, the whitespace before point is
  687. deleted and the first indentation point then applicable is used.  If no
  688. indentation point is applicable even then, `indent-relative' runs
  689. `tab-to-tab-stop' (*note Tab Stops::.).
  690.  
  691.    `indent-relative' is the definition of TAB in Indented Text mode.
  692. *Note Text::.
  693.  
  694. 
  695. File: emacs,  Node: Tab Stops,  Next: Just Spaces,  Prev: Indentation Commands,  Up: Indentation
  696.  
  697. Tab Stops
  698. =========
  699.  
  700.    For typing in tables, you can use Text mode's definition of TAB,
  701. `tab-to-tab-stop'.  This command inserts indentation before point,
  702. enough to reach the next tab stop column.  If you are not in Text mode,
  703. this command can be found on the key `M-i'.
  704.  
  705.    You can specify the tab stops used by `M-i'.  They are stored in a
  706. variable called `tab-stop-list', as a list of column-numbers in
  707. increasing order.
  708.  
  709.    The convenient way to set the tab stops is with `M-x edit-tab-stops',
  710. which creates and selects a buffer containing a description of the tab
  711. stop settings.  You can edit this buffer to specify different tab
  712. stops, and then type `C-c C-c' to make those new tab stops take effect.
  713. In the tab stop buffer, `C-c C-c' runs the function
  714. `edit-tab-stops-note-changes' rather than its usual definition
  715. `save-buffer'.  `edit-tab-stops' records which buffer was current when
  716. you invoked it, and stores the tab stops back in that buffer; normally
  717. all buffers share the same tab stops and changing them in one buffer
  718. affects all, but if you happen to make `tab-stop-list' local in one
  719. buffer then `edit-tab-stops' in that buffer will edit the local
  720. settings.
  721.  
  722.    Here is what the text representing the tab stops looks like for
  723. ordinary tab stops every eight columns.
  724.  
  725.              :       :       :       :       :       :
  726.      0         1         2         3         4
  727.      0123456789012345678901234567890123456789012345678
  728.      To install changes, type C-c C-c
  729.  
  730.    The first line contains a colon at each tab stop.  The remaining
  731. lines are present just to help you see where the colons are and know
  732. what to do.
  733.  
  734.    Note that the tab stops that control `tab-to-tab-stop' have nothing
  735. to do with displaying tab characters in the buffer.  *Note Display
  736. Vars::, for more information on that.
  737.  
  738. 
  739. File: emacs,  Node: Just Spaces,  Prev: Tab Stops,  Up: Indentation
  740.  
  741. Tabs vs. Spaces
  742. ===============
  743.  
  744.    Emacs normally uses both tabs and spaces to indent lines.  If you
  745. prefer, all indentation can be made from spaces only.  To request this,
  746. set `indent-tabs-mode' to `nil'.  This is a per-buffer variable;
  747. altering the variable affects only the current buffer, but there is a
  748. default value which you can change as well.  *Note Locals::.
  749.  
  750.    There are also commands to convert tabs to spaces or vice versa,
  751. always preserving the columns of all nonblank text.  `M-x tabify' scans
  752. the region for sequences of spaces, and converts sequences of at least
  753. three spaces to tabs if that can be done without changing indentation.
  754. `M-x untabify' changes all tabs in the region to appropriate numbers of
  755. spaces.
  756.  
  757. 
  758. File: emacs,  Node: Text,  Next: Programs,  Prev: Indentation,  Up: Top
  759.  
  760. Commands for Human Languages
  761. ****************************
  762.  
  763.    The term "text" has two widespread meanings in our area of the
  764. computer field.  One is data that is a sequence of characters.  Any file
  765. that you edit with Emacs is text, in this sense of the word.  The other
  766. meaning is more restrictive: a sequence of characters in a human
  767. language for humans to read (possibly after processing by a text
  768. formatter), as opposed to a program or commands for a program.
  769.  
  770.    Human languages have syntactic/stylistic conventions that can be
  771. supported or used to advantage by editor commands: conventions involving
  772. words, sentences, paragraphs, and capital letters.  This chapter
  773. describes Emacs commands for all of these things.  There are also
  774. commands for "filling", which means rearranging the lines of a
  775. paragraph to be approximately equal in length.  The commands for moving
  776. over and killing words, sentences and paragraphs, while intended
  777. primarily for editing text, are also often useful for editing programs.
  778.  
  779.    Emacs has several major modes for editing human language text.  If
  780. the file contains text pure and simple, use Text mode, which customizes
  781. Emacs in small ways for the syntactic conventions of text.  For text
  782. which contains embedded commands for text formatters, Emacs has other
  783. major modes, each for a particular text formatter.  Thus, for input to
  784. TeX, you would use TeX mode; for input to nroff, Nroff mode.
  785.  
  786. * Menu:
  787.  
  788. * Words::         Moving over and killing words.
  789. * Sentences::     Moving over and killing sentences.
  790. * Paragraphs::      Moving over paragraphs.
  791. * Pages::      Moving over pages.
  792. * Filling::       Filling or justifying text.
  793. * Case::          Changing the case of text.
  794. * Text Mode::     The major modes for editing text files.
  795. * Outline Mode::  The major mode for editing outlines.
  796. * TeX Mode::      The major modes for editing input to the formatter TeX.
  797. * Nroff Mode::    The major mode for editing input to the formatter nroff.
  798.  
  799. 
  800. File: emacs,  Node: Words,  Next: Sentences,  Up: Text
  801.  
  802. Words
  803. =====
  804.  
  805.    Emacs has commands for moving over or operating on words.  By
  806. convention, the keys for them are all Meta characters.
  807.  
  808. `M-f'
  809.      Move forward over a word (`forward-word').
  810.  
  811. `M-b'
  812.      Move backward over a word (`backward-word').
  813.  
  814. `M-d'
  815.      Kill up to the end of a word (`kill-word').
  816.  
  817. `M-DEL'
  818.      Kill back to the beginning of a word (`backward-kill-word').
  819.  
  820. `M-@'
  821.      Mark the end of the next word (`mark-word').
  822.  
  823. `M-t'
  824.      Transpose two words or drag a word across other words
  825.      (`transpose-words').
  826.  
  827.    Notice how these keys form a series that parallels the
  828. character-based `C-f', `C-b', `C-d', `C-t' and DEL.  `M-@' is related
  829. to `C-@', which is an alias for `C-SPC'.
  830.  
  831.    The commands `M-f' (`forward-word') and `M-b' (`backward-word') move
  832. forward and backward over words.  These Meta characters are thus
  833. analogous to the corresponding control characters, `C-f' and `C-b',
  834. which move over single characters in the text.  The analogy extends to
  835. numeric arguments, which serve as repeat counts.  `M-f' with a negative
  836. argument moves backward, and `M-b' with a negative argument moves
  837. forward.  Forward motion stops right after the last letter of the word,
  838. while backward motion stops right before the first letter.
  839.  
  840.    `M-d' (`kill-word') kills the word after point.  To be precise, it
  841. kills everything from point to the place `M-f' would move to.  Thus, if
  842. point is in the middle of a word, `M-d' kills just the part after
  843. point.  If some punctuation comes between point and the next word, it
  844. is killed along with the word.  (If you wish to kill only the next word
  845. but not the punctuation before it, simply do `M-f' to get the end, and
  846. kill the word backwards with `M-DEL'.) `M-d' takes arguments just like
  847. `M-f'.
  848.  
  849.    `M-DEL' (`backward-kill-word') kills the word before point.  It
  850. kills everything from point back to where `M-b' would move to.  If
  851. point is after the space in `FOO, BAR', then `FOO, ' is killed.  (If
  852. you wish to kill just `FOO', do `M-b M-d' instead of `M-DEL'.)
  853.  
  854.    `M-t' (`transpose-words') exchanges the word before or containing
  855. point with the following word.  The delimiter characters between the
  856. words do not move.  For example, `FOO, BAR' transposes into `BAR, FOO'
  857. rather than `BAR FOO,'.  *Note Transpose::, for more on transposition
  858. and on arguments to transposition commands.
  859.  
  860.    To operate on the next N words with an operation which applies
  861. between point and mark, you can either set the mark at point and then
  862. move over the words, or you can use the command `M-@' (`mark-word')
  863. which does not move point, but sets the mark where `M-f' would move to.
  864. `M-@' accepts a numeric argument that says how many words to scan for
  865. the place to put the mark.
  866.  
  867.    The word commands' understanding of syntax is completely controlled
  868. by the syntax table.  Any character can, for example, be declared to be
  869. a word delimiter.  *Note Syntax::.
  870.  
  871. 
  872. File: emacs,  Node: Sentences,  Next: Paragraphs,  Prev: Words,  Up: Text
  873.  
  874. Sentences
  875. =========
  876.  
  877.    The Emacs commands for manipulating sentences and paragraphs are
  878. mostly on Meta keys, so as to be like the word-handling commands.
  879.  
  880. `M-a'
  881.      Move back to the beginning of the sentence (`backward-sentence').
  882.  
  883. `M-e'
  884.      Move forward to the end of the sentence (`forward-sentence').
  885.  
  886. `M-k'
  887.      Kill forward to the end of the sentence (`kill-sentence').
  888.  
  889. `C-x DEL'
  890.      Kill back to the beginning of the sentence
  891.      (`backward-kill-sentence').
  892.  
  893.    The commands `M-a' and `M-e' (`backward-sentence' and
  894. `forward-sentence') move to the beginning and end of the current
  895. sentence, respectively.  They were chosen to resemble `C-a' and `C-e',
  896. which move to the beginning and end of a line.  Unlike them, `M-a' and
  897. `M-e' if repeated or given numeric arguments move over successive
  898. sentences.  Emacs assumes that the typist's convention is followed, and
  899. thus considers a sentence to end wherever there is a `.', `?' or `!'
  900. followed by the end of a line or two spaces, with any number of `)',
  901. `]', `'', or `"' characters allowed in between.  A sentence also begins
  902. or ends wherever a paragraph begins or ends.
  903.  
  904.    Neither `M-a' nor `M-e' moves past the newline or spaces beyond the
  905. sentence edge at which it is stopping.
  906.  
  907.    Just as `C-a' and `C-e' have a kill command, `C-k', to go with them,
  908. so `M-a' and `M-e' have a corresponding kill command `M-k'
  909. (`kill-sentence') which kills from point to the end of the sentence.
  910. With minus one as an argument it kills back to the beginning of the
  911. sentence.  Larger arguments serve as a repeat count.
  912.  
  913.    There is a special command, `C-x DEL' (`backward-kill-sentence') for
  914. killing back to the beginning of a sentence, because this is useful
  915. when you change your mind in the middle of composing text.
  916.  
  917.    The variable `sentence-end' controls recognition of the end of a
  918. sentence.  It is a regexp that matches the last few characters of a
  919. sentence, together with the whitespace following the sentence.  Its
  920. normal value is
  921.  
  922.      "[.?!][]\"')]*\\($\\|\t\\|  \\)[ \t\n]*"
  923.  
  924. This example is explained in the section on regexps.  *Note Regexps::.
  925.  
  926. 
  927. File: emacs,  Node: Paragraphs,  Next: Pages,  Prev: Sentences,  Up: Text
  928.  
  929. Paragraphs
  930. ==========
  931.  
  932.    The Emacs commands for manipulating paragraphs are also Meta keys.
  933.  
  934. `M-{'
  935.      Move back to previous paragraph beginning (`backward-paragraph').
  936.  
  937. `M-}'
  938.      Move forward to next paragraph end (`forward-paragraph').
  939.  
  940. `M-h'
  941.      Put point and mark around this or next paragraph
  942.      (`mark-paragraph').
  943.  
  944.    `M-{' moves to the beginning of the current or previous paragraph,
  945. while `M-}' moves to the end of the current or next paragraph.  Blank
  946. lines and text formatter command lines separate paragraphs and are not
  947. part of any paragraph.  Also, an indented line starts a new paragraph.
  948.  
  949.    In major modes for programs (as opposed to Text mode), paragraphs
  950. begin and end only at blank lines.  This makes the paragraph commands
  951. continue to be useful even though there are no paragraphs per se.
  952.  
  953.    When there is a fill prefix, then paragraphs are delimited by all
  954. lines which don't start with the fill prefix.  *Note Filling::.
  955.  
  956.    When you wish to operate on a paragraph, you can use the command
  957. `M-h' (`mark-paragraph') to set the region around it.  This command
  958. puts point at the beginning and mark at the end of the paragraph point
  959. was in.  If point is between paragraphs (in a run of blank lines, or at
  960. a boundary), the paragraph following point is surrounded by point and
  961. mark.  If there are blank lines preceding the first line of the
  962. paragraph, one of these blank lines is included in the region.  Thus,
  963. for example, `M-h C-w' kills the paragraph around or after point.
  964.  
  965.    The precise definition of a paragraph boundary is controlled by the
  966. variables `paragraph-separate' and `paragraph-start'.  The value of
  967. `paragraph-start' is a regexp that should match any line that either
  968. starts or separates paragraphs.  The value of `paragraph-separate' is
  969. another regexp that should match only lines that separate paragraphs
  970. without being part of any paragraph.  Lines that start a new paragraph
  971. and are contained in it must match only `paragraph-start', not
  972. `paragraph-separate'.  For example, normally `paragraph-start' is `"^[
  973. \t\n\f]"' and `paragraph-separate' is `"^[ \t\f]*$"'.
  974.  
  975.    Normally it is desirable for page boundaries to separate paragraphs.
  976. The default values of these variables recognize the usual separator for
  977. pages.
  978.  
  979. 
  980. File: emacs,  Node: Pages,  Next: Filling,  Prev: Paragraphs,  Up: Text
  981.  
  982. Pages
  983. =====
  984.  
  985.    Files are often thought of as divided into "pages" by the "formfeed"
  986. character (ASCII control-L, octal code 014).  For example, if a file is
  987. printed on a line printer, each page of the file, in this sense, will
  988. start on a new page of paper.  Emacs treats a page-separator character
  989. just like any other character.  You can insert it with `C-q C-l', or
  990. delete it with DEL.  Thus, you are free to paginate your file or not.
  991. However, since pages are often meaningful divisions of the file, Emacs
  992. provides commands to move over them and operate on them.
  993.  
  994. `C-x ['
  995.      Move point to previous page boundary (`backward-page').
  996.  
  997. `C-x ]'
  998.      Move point to next page boundary (`forward-page').
  999.  
  1000. `C-x C-p'
  1001.      Put point and mark around this page (or another page)
  1002.      (`mark-page').
  1003.  
  1004. `C-x l'
  1005.      Count the lines in this page (`count-lines-page').
  1006.  
  1007.    The `C-x [' (`backward-page') command moves point to immediately
  1008. after the previous page delimiter.  If point is already right after a
  1009. page delimiter, it skips that one and stops at the previous one.  A
  1010. numeric argument serves as a repeat count.  The `C-x ]' (`forward-page')
  1011. command moves forward past the next page delimiter.
  1012.  
  1013.    The `C-x C-p' command (`mark-page') puts point at the beginning of
  1014. the current page and the mark at the end.  The page delimiter at the end
  1015. is included (the mark follows it).  The page delimiter at the front is
  1016. excluded (point follows it).  This command can be followed by `C-w' to
  1017. kill a page which is to be moved elsewhere.  If it is inserted after a
  1018. page delimiter, at a place where `C-x ]' or `C-x [' would take you, then
  1019. the page will be properly delimited before and after once again.
  1020.  
  1021.    A numeric argument to `C-x C-p' is used to specify which page to go
  1022. to, relative to the current one.  Zero means the current page.  One
  1023. means the next page, and -1 means the previous one.
  1024.  
  1025.    The `C-x l' command (`count-lines-page') is good for deciding where
  1026. to break a page in two.  It prints in the echo area the total number of
  1027. lines in the current page, and then divides it up into those preceding
  1028. the current line and those following, as in
  1029.  
  1030.      Page has 96 (72+25) lines
  1031.  
  1032. Notice that the sum is off by one; this is correct if point is not at
  1033. the beginning of a line.
  1034.  
  1035.    The variable `page-delimiter' controls where pages begin.  Its value
  1036. is a regexp that matches the beginning of a line that separates pages.
  1037. The normal value of this variable is `"^\f"', which matches a formfeed
  1038. character at the beginning of a line.
  1039.  
  1040. 
  1041. File: emacs,  Node: Filling,  Next: Case,  Prev: Pages,  Up: Text
  1042.  
  1043. Filling Text
  1044. ============
  1045.  
  1046.    With Auto Fill mode, text can be "filled" (broken up into lines that
  1047. fit in a specified width) as you insert it.  If you alter existing text
  1048. it may no longer be properly filled; then you can use the explicit fill
  1049. commands to fill the paragraph again.
  1050.  
  1051. * Menu:
  1052.  
  1053. * Auto Fill::       Auto Fill mode breaks long lines automatically.
  1054. * Fill Commands::  Commands to refill paragraphs and center lines.
  1055. * Fill Prefix::    Filling when every line is indented or in a comment, etc.
  1056.  
  1057. 
  1058. File: emacs,  Node: Auto Fill,  Next: Fill Commands,  Up: Filling
  1059.  
  1060. Auto Fill Mode
  1061. --------------
  1062.  
  1063.    "Auto Fill" mode is a minor mode in which lines are broken
  1064. automatically when they become too wide.  Breaking happens only when
  1065. you type a SPC or RET.
  1066.  
  1067. `M-x auto-fill-mode'
  1068.      Enable or disable Auto Fill mode.
  1069.  
  1070. `SPC'
  1071. `RET'
  1072.      In Auto Fill mode, break lines when appropriate.
  1073.  
  1074.    `M-x auto-fill-mode' turns Auto Fill mode on if it was off, or off if
  1075. it was on.  With a positive numeric argument it always turns Auto Fill
  1076. mode on, and with a negative argument always turns it off.  You can see
  1077. when Auto Fill mode is in effect by the presence of the word `Fill' in
  1078. the mode line, inside the parentheses.  Auto Fill mode is a minor mode,
  1079. turned on or off for each buffer individually.  *Note Minor Modes::.
  1080.  
  1081.    In Auto Fill mode, lines are broken automatically at spaces when
  1082. they get longer than the desired width.  Line breaking and
  1083. rearrangement takes place only when you type SPC or RET.  If you wish
  1084. to insert a space or newline without permitting line-breaking, type
  1085. `C-q SPC' or `C-q LFD' (recall that a newline is really a linefeed).
  1086. Also, `C-o' inserts a newline without line breaking.
  1087.  
  1088.    Auto Fill mode works well with Lisp mode, because when it makes a new
  1089. line in Lisp mode it indents that line with TAB.  If a line ending in a
  1090. comment gets too long, the text of the comment is split into two
  1091. comment lines.  Optionally new comment delimiters are inserted at the
  1092. end of the first line and the beginning of the second so that each line
  1093. is a separate comment; the variable `comment-multi-line' controls the
  1094. choice (*note Comments::.).
  1095.  
  1096.    Auto Fill mode does not refill entire paragraphs.  It can break
  1097. lines but cannot merge lines.  So editing in the middle of a paragraph
  1098. can result in a paragraph that is not correctly filled.  The easiest
  1099. way to make the paragraph properly filled again is usually with the
  1100. explicit fill commands.  *Note Fill Commands::.
  1101.  
  1102.    Many users like Auto Fill mode and want to use it in all text files.
  1103. The section on init files says how to arrange this permanently for
  1104. yourself.  *Note Init File::.
  1105.  
  1106. 
  1107. File: emacs,  Node: Fill Commands,  Next: Fill Prefix,  Prev: Auto Fill,  Up: Filling
  1108.  
  1109. Explicit Fill Commands
  1110. ----------------------
  1111.  
  1112. `M-q'
  1113.      Fill current paragraph (`fill-paragraph').
  1114.  
  1115. `C-x f'
  1116.      Set the fill column (`set-fill-column').
  1117.  
  1118. `M-x fill-region'
  1119.      Fill each paragraph in the region (`fill-region').
  1120.  
  1121. `M-x fill-region-as-paragraph.'
  1122.      Fill the region, considering it as one paragraph.
  1123.  
  1124. `M-s'
  1125.      Center a line.
  1126.  
  1127.    To refill a paragraph, use the command `M-q' (`fill-paragraph').
  1128. This operates on the paragraph that point is inside, or the one after
  1129. point if point is between paragraphs.  Refilling works by removing all
  1130. the line-breaks, then inserting new ones where necessary.
  1131.  
  1132.    The command `M-s' (`center-line') centers the current line within
  1133. the current fill column.  With an argument, it centers several lines
  1134. individually and moves past them.
  1135.  
  1136.    To refill many paragraphs, use `M-x fill-region', which divides the
  1137. region into paragraphs and fills each of them.
  1138.  
  1139.    `M-q' and `fill-region' use the same criteria as `M-h' for finding
  1140. paragraph boundaries (*note Paragraphs::.).  For more control, you can
  1141. use `M-x fill-region-as-paragraph', which refills everything between
  1142. point and mark.  This command deletes any blank lines within the
  1143. region, so separate blocks of text end up combined into one block.
  1144.  
  1145.    A numeric argument to `M-q' causes it to "justify" the text as well
  1146. as filling it.  This means that extra spaces are inserted to make the
  1147. right margin line up exactly at the fill column.  To remove the extra
  1148. spaces, use `M-q' with no argument.  (Likewise for `fill-region'.)
  1149.  
  1150.    When `adaptive-fill-mode' is non-`nil' (which is normally the case),
  1151. if you use `fill-region-as-paragraph' on an indented paragraph and you
  1152. don't have a fill prefix, it uses the indentation of the second line of
  1153. the paragraph as the fill prefix.  The effect of adaptive filling is
  1154. not noticeable in Text mode, because an indented line counts as a
  1155. paragraph starter and thus each line of an indented paragraph is
  1156. considered a paragraph of its own.  But you do notice the effect in
  1157. Indented Text mode and some other major modes.
  1158.  
  1159.    The maximum line width for filling is in the variable `fill-column'.
  1160. Altering the value of `fill-column' makes it local to the current
  1161. buffer; until that time, the default value is in effect.  The default is
  1162. initially 70.  *Note Locals::.
  1163.  
  1164.    The easiest way to set `fill-column' is to use the command `C-x f'
  1165. (`set-fill-column').  With no argument, it sets `fill-column' to the
  1166. current horizontal position of point.  With a numeric argument, it uses
  1167. that as the new fill column.
  1168.  
  1169.